﻿namespace System.Data.Entity
{
    using Linq;
    using Linq.Expressions;

    public interface IDbContext<TId> : IDisposable
    {
        IQueryable<TEntity> All<TEntity>(params Expression<Func<TEntity, object>>[] includeProperties) where TEntity : class, IEntity<TId>;

        TEntity Find<TEntity>(TId id) where TEntity : class, IEntity<TId>;

        TEntity Create<TEntity>() where TEntity : class, IEntity<TId>;

        TId Insert<TEntity>(TEntity entity) where TEntity : class, IEntity<TId>;

        void Update<TEntity>(TEntity entity) where TEntity : class, IEntity<TId>;

        void Delete<TEntity>(TId id) where TEntity : class, IEntity<TId>;

        int SaveChanges();
    }
}
